<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>商品信息列表</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
<#include "../template/include/assign.ftl">
<#include "../template/include/source.ftl">
<#include "../template/template_listPage.ftl">
    <link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        .page {
            float: right;
            padding-top: 15px;
            margin-right: 15px;
        }
    </style>

    <script type="text/javascript">
        $(document).ready(function () {
            $('#searchButton').click(
                    function () {
                        $('#currentPage_listForm').val('1');
                    }
            );

            $('#goodsState').val('<#if goodsQuery??>${(goodsQuery.goodsState)!}</#if>');
            $('#rechargeMode').val('<#if goodsQuery??>${(goodsQuery.rechargeMode)!}</#if>');
            $('#enable').val('<#if goodsQuery??>${(goodsQuery.enable)!}</#if>');
            $('#heat').val('<#if goodsQuery??>${(goodsQuery.heat)!}</#if>');
            
             $('.follow-cursor').poshytip({
                    className: 'tip-darkgray',
	                followCursor: true,
	                slide: false
                });
        });

        function offline(id,goodsId) {
            var result = confirm("你确认要下架此商品吗?");
            if (result) {
                var url = "${web_base}/game/goods!updateState.htm?id=" + id + "&goodsId=" + goodsId + "&goodsState=0";
                document.forms[0].action = url;
                document.forms[0].submit();
            }
        }

        function online(id, goodsId) {
            var result = confirm("你确认要上架此商品吗?");
            if (result) {
                var url = "${web_base}/game/goods!updateState.htm?id=" + id + "&goodsId=" + goodsId + "&goodsState=1";
                document.forms[0].action = url;
                document.forms[0].submit();
            }
        }

        function editGoods(goodsId){
            var goId = $('#goodsId').val();
            var brandId = $('#goodsCategoryId').val();
            var goodsName = $('#goodsName').val();
            var rechargeMode = $('#rechargeMode').val();
            var url = "${web_base}/game/goods!toEdit.htm?goodsId=" + goodsId;

            if (goId != null && goId != '') {
                url = url + "&goId=" + goId;
            }
            if(brandId != null && brandId != ''){
                url = url + "&brandId=" + brandId;
            }
            if(goodsName != null && goodsName != ''){
                url = url + "&goodsName=" +goodsName;
            }
            if(rechargeMode != null && rechargeMode != ''){
                url = url + "&rechargeMode=" + rechargeMode;
            }
            document.forms[0].action =  encodeURI(url);
            document.forms[0].submit();

        }

        function goodsDele(goodsId) {
            var result = confirm("确认要删除吗？");
            if (result) {
                var url = "${web_base}/game/goods!delete.htm?goodsId=" + goodsId;
                document.forms[0].action = url;
                document.forms[0].submit();
            }
        }
        
        function noticeUser(goodsId){
      	 var url = "${web_base}/game/goods!noticeUser.htm?goodsId=" + goodsId;
      	 document.forms[0].action = encodeURI(url);
         document.forms[0].submit();
       }

        $().ready(function () {
        <#if actionErrors?? && (actionErrors?size > 0)>
            $.dialog({type:"warn", content:"<#list errorMessages as list>${list}<br></#list>",
                modal:true, autoCloseTime:3000});
        </#if>
        });
    </script>
</head>
<body class="list">
<div class="body">
    <div class="listBar">
        <h1><span class="icon">&nbsp;</span>商品信息管理&nbsp;<span class="pageInfo"></span></h1>
    </div>
<@pageList page=(page!) id="listForm" action="${web_base}/game/goods!goodsList.htm" query="goodsQuery" isEmpty=true>
    <div class="operateBar">
    <input type="button" class="addButton" onclick="location.href='${web_base}/game/goods!add.htm'" value="添加商品" />
        查找:
        商品编号：<input type="text" id="goodsId" name="goodsQuery.goodsId" value="<#if goodsQuery??>${(goodsQuery.goodsId)!}</#if>"/>
        商品品牌编号：<input type="text" id="goodsCategoryId" name="goodsQuery.goodsCategoryId"
                      value="<#if goodsQuery??>${(goodsQuery.goodsCategoryId)!}</#if>"/><br/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        商品名称：<input type="text" id="goodsName" name="goodsQuery.goodsName" value="<#if goodsQuery??>${(goodsQuery.goodsName)!}</#if>"/>
        商品品牌名称：<input type="text" id="gameName" name="goodsQuery.brandName"
                      value="<#if goodsQuery??>${(goodsQuery.brandName)!}</#if>"/>
        商品状态：<select name="goodsQuery.goodsState" id="goodsState">
        <option value="1">
            上架
        </option>
        <option value="0">
            下架
        </option>
    </select>
        热度选择：<select name="goodsQuery.heat" id="heat">
        <option value="">请选择...</option>
        <option value=2>
            热门
        </option>
        <option value=1>
            一般
        </option>
    </select>
        充值方式：
        <select name="goodsQuery.rechargeMode" id="rechargeMode">
            <option value="" selected="selected">请选择...</option>
            <option value="2">
                直充
            </option>
            <option value="1">
                卡充
            </option>
        </select>
        <input type="submit" id="searchButton" class="searchButton" value=""/>
    </div>
    <table class="listTable">
        <tr>
            <th>
                <span class="sort" name="goodsId">商品编号</span>
            </th>
            <th>
                <span class="sort" name="goodsCategoryId">品牌编号</span>
            </th>
            <th>
                <span class="sort" name="goodsName">商品名称</span>
            </th>
            <th>
                <span class="sort" name="commonSalePrice">默认售价(元)</span>
            </th>
            <th>
                <span class="sort" name="goodsMoney">商品面值(元)</span>
            </th>
            <th>
                <span class="sort" name="rechargeMode">充值方式</span>
            </th>
            <th>
                <span class="sort" name="heat">热度</span>
            </th>
            <th>
                <span class="sort" name="insertTime">录入时间</span>
            </th>
            <th>
                <span class="sort" name="modifyTime">修改时间</span>
            </th>
            <th>
                <span class="sort" name="operator">操作员</span>
            </th>
            <th width="120">操&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作
            <th/>
        </tr>

        <#if page?? && page.list?? && (page.list?size gt 0)>
            <#list page.list as obj>
                <tr>
                    <td>
                        <a href="${web_base}/game/goods!detail.htm?goodsId=${(obj.goodsId)!}" title="详情"> ${(obj.goodsId)!}</a>
                    </td>
                    <td>
                    ${(obj.goodsCategoryId)!}
                        &nbsp;
                    </td>
                    <td  class="example">
                        <a class="follow-cursor" title="${(obj.goodsName)!}" href="#">
                        <#if obj.goodsName?? && obj.goodsName?length gt 12>
                        <#--//截取输出文字的长度-->
                        ${obj.goodsName?substring(0,12)}...
                        <#else>
                        ${(obj.goodsName)!}
                        </#if>
                        </a>
                    </td>
                    <td>
                    ${((obj.commonSalePrice!)*1.0/1000)?string("0.000")}
                    </td>
                    <td>
                        <#if obj.goodsMoney?? && obj.goodsMoney==0>
                          <#else >
                        ${((obj.goodsMoney!)*1.0/1000)?string("0.000")}
                        </#if>
                    </td>
                    <td>
                        <#if obj.rechargeMode?? && obj.rechargeMode=="2">
                            直充
                        <#elseif obj.rechargeMode?? && obj.rechargeMode=="1">
                            卡充
                        </#if>
                    </td>
                    <td>
                        <#if obj?? && obj.heat?? && obj.heat==2>
                            热门
                        <#elseif  obj?? && obj.heat?? && obj.heat==1>
                            一般
                        </#if>

                    </td>
                    <td>
                    ${(obj.insertTime)!}
                    </td>
                    <td>
                    ${(obj.modifyTime)!}
                    </td>
                    <td>
                    ${(obj.operator)!}
                    </td>
                    <td width="120">
                        <span class="spanLink" onclick="editGoods('${(obj.goodsId)!}');" title="编辑">[编辑]</span>
                        <#if (obj.goodsState)?? && obj.goodsState=="0">
                            <span class="spanLink" onclick="online('${(obj.id)!}','${obj.goodsId}');" title="上架">[上架]</span>
                        <#else>
                            [上架]
                        </#if>
                        <#if (obj.goodsState)?? && obj.goodsState=="1">
                            <span class="spanLink" onclick="offline('${(obj.id)!}','${obj.goodsId}');" title="下架">[下架]</span>
                        <#else>
                            [下架]
                        </#if>
                         <#--<span class="spanLink" onclick="goodsDele('${(obj.goodsId)!}');" title="删除">[删除]</span>-->
                        <br/>
                        <a href="${web_base}/game/goods!inputSupply.htm?goodsId=${(obj.goodsId)!}" title="新增供应">[新增供应]</a>
                        <a href="${web_base}/game/goods!toSetPrice.htm?goodsId=${(obj.goodsId)!}" title="设置价格">[设置价格]</a>
                      	<#--
                      		<br>
                        		<span class="spanLink" onclick="noticeUser('${obj.goodsId}');"
                              title="通知下游">[通知下游]</span>
                      	-->
                    </td>
                </tr>
            </#list>
        </#if>
    </table>

    <#if page?? && page.list?? && (page.list?size <= 0)>
        <div class="noRecord">
            没有找到任何记录!
        </div>
    </#if>
</@pageList>
</div>

</body>
</html>